/*
 * Copyright (c) 2012, 2021, daojian.co and/or its affiliates. All rights reserved.
 *
 */

package co.bugu.code.analysis.application.converter;

import co.bugu.code.analysis.infra.entity.User;
import co.bugu.code.analysis.application.dto.UserDto;
import org.springframework.beans.BeanUtils;
/**
 * 数据转换类
 *
 * @author happy-coder
 * @version 1.0.0
 * @createdAt 2022-06-11 11:21:37
 * @updatedAt 2022-06-11 11:21:37
 */
public class UserConverter {
    public static UserDto entityToDto(User entity) {
        if (null == entity) {
            return null;
        }
        UserDto res = new  UserDto();
        BeanUtils.copyProperties(entity, res);
        return res;

    }


//    实现从gitlab4j的User对象转换为infra的User对象
    public static User convert(org.gitlab4j.api.models.User user) {
        User infraUser = new User();
        BeanUtils.copyProperties(user, infraUser);
        infraUser.setUserId(user.getId());
        return infraUser;
    }
}
